package com.ssims.dao.sale;

import main.java.ssims.front.dao.BaseDAO;
import main.java.ssims.front.dao.gsm.IGoodsSaleDAO;
import main.java.ssims.front.entity.GoodsSaleEntity;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by coliza on 2014/8/15.
 */
@Repository("goodsSaleDAO")
public class GoodsSaleDAO extends BaseDAO implements IGoodsSaleDAO {
    @Override
    public List<GoodsSaleEntity> query() {
        return sqlSession.selectList("GoodsSaleMapper.select");
    }
    @Override
    public int insert(GoodsSaleEntity entity) {
        return sqlSession.insert("GoodsSaleMapper.insert", entity);
    }
    @Override
    public boolean delete(String id) {
        int count = sqlSession.delete("GoodsSaleMapper.deleteById", id);
        if (count > 0) return true;
        return false;
    }

    @Override
    public boolean update(GoodsSaleEntity entity) {
        int count = sqlSession.update("GoodsSaleMapper.update", entity);
        if (count > 0) return true;
        return false;
    }

    @Override
    public GoodsSaleEntity queryById(String id) {
        return sqlSession.selectOne("GoodsSaleMapper.selectOneById", id);
    }
}
